feat: switch start flow to Codex Cloud session lifecycle - #6
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
codex execruns with Codex Cloud sessions so each step executes in an isolated cloud sandbox and can be resumed across process restarts.session_idper step sovexdo start --resumecan continue in-flight cloud runs and support arbiter fix/resume iterations.Description
src/lib/codex.tsto implement the cloud lifecycle helpers:submitTask(prompt, {cwd}),resumeTask(sessionId, feedback),pollStatus(sessionId, {intervalMs, timeoutMs}),getDiff(sessionId), andapplyDiff(sessionId), plusexecas a convenience wrapper; addedCodexTimeoutErrorand structuredCodexErrorwith codes.src/commands/start.tsto drive the new cloud flow: submit → poll → diff → review, and addedrunCloudReviewLoopto handle review/arbiter cycles and callresumeTaskwhen fixes are requested.CodexErrorCodeandsession_id?: stringtosrc/types/index.tsand persistsession_idto step state viasrc/lib/state.tsso resume works across restarts.test/unit/codex.test.tsfor session parsing, polling, timeout and diff handling, and updated integration tests intests/integration/start.test.tsto validate submit/poll/diff/resume interactions andsession_idpersistence.Testing
npm test -- --run test/unit/codex.test.ts tests/integration/start.test.tswhich passed.npm testwhich passed all tests (62 passed), and built the CLI withnpm run buildwhich succeeded.Codex Task